package com.example.securingadmin;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author caiwl
 * @date 2020/12/8 14:47
 */
@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;

    @PostMapping("/login")
    public String login(String username, String password) {
        return loginService.login(username, password);
    }

    @GetMapping("/info")
    public String info() {
        return SecurityUtils.getLoginUser().getUsername();
    }
}
